import random

son1 = genSoundTable('ounkmaster.aif')

a = genWaveform()

setGlobalDuration(-1)

randomi(bus='rand', rate=.3)
vibrato('vibra', frequency=5, amplitude=.25, frequencyVar='rand')

beginMidiSynth(release=1)

# from pitch 0 to 59
splitKeyboard(firstnote=0, endnote=59, centralkey=48)
linsegr([1,2,3,4,5], 1, .2, 1.2, .2, 1, 1, 1, final=[.5,.8, 1, 1.3, 2])
midiSynthGetBus(bus='vibra', input='vibra') # get bus outside of midiSynth
pitchs = [random.randint(200,220)*2 for x in range(5)]
sine(pitch=pitchs, amplitude=.1, pan=[0,.25,.5,.75,1], pitchVar='vibra')
looper(table=son1, pitch=[.999, 1.001], pan=[0, 1], amplitude=[1,1])

# from pitch 60 to 127
splitKeyboard(firstnote=60, endnote=127, centralkey=72)
linsegr(bus='amp', i1=0, dur1=.01, i2=1, dur2=.25, i3=.7, final=0)
freqMod(pitch=[50, 100,250], amplitude=.5, modulator=[.51,.49,1.01], index=8, amplitudeVar='amp', indexVar='amp')

endMidiSynth(out='synth')

waveguideReverb(input='synth', amplitude=.7)

startCsound()